home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / iconp.zip / TRIM.ICN < prev   
Text File  |  1987-05-29  |  475b  |  27 lines

  1. #    TRIM(1)
  2. #
  3. #    Trim lines
  4. #
  5. #    Ralph E. Griswold
  6. #
  7. #    Last modified 7/10/83
  8. #
  9.  
  10. procedure main(x)
  11.    local n, i, pad, s, line
  12.    n := 80
  13.    pad := 0
  14.    i := 0
  15.    while i < *x do {
  16.       s := x[i +:= 1] | break
  17.       if s == "-f" then pad := 1
  18.       else if not(n := (0 <= integer(s))) then stop("usage: trim [n] [-f]")
  19.       }
  20.    while line := read() do {
  21.       line := line[1+:n]
  22.       line := trim(line)
  23.       if pad = 1 then line := left(line,n)
  24.       write(line)
  25.       }
  26. end
  27.